using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class mapnode :MonoBehaviour
{
    public List<node> allstoppoint = new List<node>();
    public List<List<int>> path = new List<List<int>>();
    private int[,] nodemap = new int[18, 18];
    private void Initnodemap()
    {
        for(int i=0;i<18;i++)
        {
            for (int j = 0; j < 18;j++)
            {
                nodemap[i, j] = 0;
            }
        }
    }
    private void addjmatrix(int i,int j)
    {
        nodemap[i, j] = 1;
    }
    private void AddAllmatrix()
    {
        addjmatrix(0, 1);
        addjmatrix(1, 2);
        addjmatrix(2, 3);
        addjmatrix(2, 4);
        addjmatrix(4, 6);
        addjmatrix(6, 7);
        addjmatrix(3, 5);
        addjmatrix(5, 7);
        addjmatrix(5, 8);
        addjmatrix(5, 12);
        addjmatrix(7, 10);
        addjmatrix(7,10);
        addjmatrix(9, 9);
        addjmatrix(10, 11);
        addjmatrix(5, 8);
        addjmatrix(8, 11);
        addjmatrix(11,14);
        addjmatrix(14, 13);
        addjmatrix(14, 16);
        addjmatrix(12, 13);
        addjmatrix(15, 13);
        addjmatrix(16, 17);
        addjmatrix(5, 7);
        addjmatrix(17, 15);
        addjmatrix(13, 9);
    }
    private void AddNodeNextnode()
    {
        for(int i=0;i<18;i++)
        {
           for(int j=0;j<18;j++)
            {
                if (nodemap[i,j]==1)
                {
                    allstoppoint[i].nextnode.Add(allstoppoint[j]);
                }
            }
        }
    }
    
    private void AddAllPlayerPath()
    {
        path.Add(new List<int> {1,2,3,5,12,13,9 });
       
    }
    private void Awake()
    {
        
        Initnodemap();
        AddAllmatrix();
        AddNodeNextnode();
        AddAllPlayerPath();
    }
}
